<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    var num1=Math.floor(Math.random()* (50-1+1)+1)
    while(true){
        var num=Number(prompt('请输入一个1-50之间的整数'))
    if(num>num1){
        alert('大了')
    }else if(num<num1){
        alert('小了')
    }else{
        alert('对了')
        break;
    }
    }
</script>